var app =  angular.module('ZJPC')
//计算年龄
app.filter('ageFilter', function() {
     function calculateAge(birthday) { // birthday is a date
     	var date = new Date(birthday)
         var ageDifMs = Date.now() - date.getTime();
         var ageDate = new Date(ageDifMs); // miliseconds from epoch
         return Math.abs(ageDate.getUTCFullYear() - 1970);
     }

     return function(birthdate) { 
           return calculateAge(birthdate);
     }; 
});

//根据位数省略，传入位数
app.filter('LimitNumber', function() {
	function limitNumber(txt,num) {
     	var str = txt;
     	if(txt.length>num-1){
	        str = str.substr(0,num) + '...' ;
     	}
         return str;
     }
     return function(tolimit,num) { 
           return limitNumber(tolimit,num);
     }; 
});